package routers

import (
	"github.com/labstack/echo/v4"
	"note/service/handler"
	"note/service/interceptor"
)

func InitRouter() *echo.Echo {
	r := echo.New()

	r.Use(interceptor.Logger())
	r.Use(interceptor.Cors())
	r.Use(interceptor.Recover())
	r.POST("/auth", handler.Auth)      //获取登录token
	r.GET("/captcha", handler.Captcha) // 生成二维码

	api := r.Group("/api")
	api.Use(interceptor.JWT())             // token 验证
	api.GET("/area", handler.GetArea)      // 获取地址
	api.GET("/school", handler.GetSchools) // 获取学校信息
	api.GET("/order", handler.GetOrder)    // 获取订单
	return r
}
